package com.ruoyi.common.utils;

import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.teautil.models.RuntimeOptions;

import static com.ruoyi.common.utils.http.HttpUtils.sendGet;

public class SMSUtils {

//    public static void sendMessage(String phoneNum, String code) {
//        String s = sendGet("https://api-v4.mysubmail.com/sms/send?appid=109643&signature=a723473e64368a399df52cac7b2727ab&to=" + phoneNum + "&content=【天启数科】您的验证码" + code + "，该验证码1分钟内有效，请勿泄漏于他人！");
//        System.out.println("向" + phoneNum + "发送验证码响应：" + s);
//    }
//
//    public static void sendReport(String phoneNum, String path, String code) {
//        try {
//            Client client = SMSUtils.createClient("LTAI4GBNVhJgQXMwQjwqNUsY", "v8aTmMtrTfZSgmgx0yXu4UIlYycmiQ");
//            SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(
//                    new SendSmsRequest().setPhoneNumbers(phoneNum).setSignName("天启数科").setTemplateCode("SMS_474285277").setTemplateParam("{\"name\":\"" + path + "\",\"code\":\"" + code + "\"}"),
//                    new RuntimeOptions()
//            );
//            System.out.println("向" + phoneNum + "发送报告响应：" + sendSmsResponse.getBody().getMessage());
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
//
//    public static Client createClient(String accessKeyId, String accessKeySecret) throws Exception {
//        Config config = new Config().setAccessKeyId(accessKeyId).setAccessKeySecret(accessKeySecret);
//        // 访问的域名
//        config.endpoint = "dysmsapi.aliyuncs.com";
//        return new Client(config);
//    }

}

